package com.micheal.springbootpostgresqldemo.controller;


import com.alibaba.fastjson.JSON;
import com.micheal.springbootpostgresqldemo.controller.base.BaseController;
import com.micheal.springbootpostgresqldemo.entity.User;
import com.micheal.springbootpostgresqldemo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author micheal
 * @since 2019-11-20
 */
@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private IUserService userService;


    @GetMapping("/list")
    public String list(){
        List<User> list = userService.list();
        return JSON.toJSONString(list);
    }

}
